package main

import (
	"context"
	"fmt"
	"time"

	gaussdb "github.com/HuaweiCloudDeveloper/gaussdb-go"
)

func main() {
	url := "gaussdb://zvgm_dev:zvgm2025$gauss_dev@10.2.130.253:8000/zvgm?sslmode=require"

	// 建立连接
	conn, err := gaussdb.Connect(context.Background(), url)
	if err != nil {
		panic(fmt.Sprintf("连接失败: %v", err))
	}
	defer conn.Close(context.Background())

	// 执行简单查询
	var now time.Time
	err = conn.QueryRow(context.Background(), "SELECT NOW()").Scan(&now)
	if err != nil {
		panic(err)
	}

	fmt.Printf("当前时间: %s", now)
}
